package fr.uniscol.view;

import java.io.Serializable;
import javax.servlet.http.HttpSession;

public class Alert implements Serializable {

	private String css = null;
	
	private String messageCode = null;
	
	private String defaultMessage = null;
	
	private String icon = null;
	
	private Alert(){
	}
	
	public Alert(String css, String messageCode, String defaultMessage) {
		this.css = css;
		this.messageCode = messageCode;
		this.defaultMessage = defaultMessage;
	}

	public String getCss() {
		return css;
	}

	public void setCss(String css) {
		this.css = css;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getMessageCode() {
		return messageCode;
	}

	public void setMessageCode(String messageCode) {
		this.messageCode = messageCode;
	}

	public String getDefaultMessage() {
		return defaultMessage;
	}

	public void setDefaultMessage(String defaultMessage) {
		this.defaultMessage = defaultMessage;
	}

	public static Alert createAlert(String css, String messageCode, String defaultMessage){
		return new Alert(css, messageCode, defaultMessage);
	}
	
	public static Alert createAlertInfo(String messageCode, String defaultMessage){
		Alert alert = new Alert("alert alert-info alert-dismissable", messageCode, defaultMessage);
		alert.setIcon("glyphicon glyphicon-info-sign");
		return alert;
	}
	
	public static Alert createAlertSuccess(String messageCode, String defaultMessage){
		Alert alert = new Alert("alert alert-success alert-dismissable", messageCode, defaultMessage);
		alert.setIcon("glyphicon glyphicon-ok");
		return alert;
	}
	
	public static Alert createAlertError(String messageCode, String defaultMessage){
		Alert alert = new Alert("alert alert-danger alert-dismissable", messageCode, defaultMessage);
		alert.setIcon("glyphicon glyphicon-remove");
		return alert;
	}
}
